/**
 * Copyright (C) 2013 AirChina
 *
 * @description:
 * @version:v1.0.0
 */
package com.china.api.wechat.processor.main;

import java.util.Date;

/**
 * @Description:
 * @author:larry
 * @Created:2013-10-29上午11:05:19
 */
public class TextResponse extends Response {

	private static final long serialVersionUID = 1L;
	private String data;

	public String getData() {
		return data;
	}

	public TextResponse(String userId, String data) {
		setUserId(userId);
		this.data = data;
	}

	@Override
	public String toXML() {

		StringBuilder sb = new StringBuilder();
		Long date = new Date().getTime();
		sb.append("<xml>\n");
		sb.append("<ToUserName><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></ToUserName>\n");
		sb.append("<FromUserName><![CDATA[");
		sb.append(getMyid());
		sb.append("]]></FromUserName>\n");
		sb.append("<CreateTime>");
		sb.append(date);
		sb.append("</CreateTime>\n");
		sb.append("<MsgType><![CDATA[text]]></MsgType>\n");
		sb.append("<Content><![CDATA[");
		sb.append(data);
		sb.append("]]></Content>\n");
		sb.append("<FuncFlag>0</FuncFlag>\n");
		sb.append("</xml>\n");
		return sb.toString();
	}

}
